using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using LeisureCenter.Api;

namespace LeisureCenter.Controls
{
    public partial class DialogControl : UserControl, IDialogControl
    {
        private IFocusHandler focusHandler;
        private bool showOkButton = true;
        private bool showCancelButton = true;
        private bool showAlphaBackground = true;
        private Color alphaBackgroundColor = Color.White;
        private string title = "";

        public DialogControl()
        {
            InitializeComponent();
        }

        #region IDialogControl Membres

        [Browsable(false)]
        public Control Control { get { return this; } }

        [Category("DialogControl")]
        public IFocusHandler FocusHandler { get { return this.focusHandler; } set { this.focusHandler = value; } }

        [Category("DialogControl")]
        public bool ShowCancelButton
        {
            get { return this.showCancelButton; }
            set { this.showCancelButton = value; }
        }

        [Category("DialogControl")]
        public bool ShowOkButton
        {
            get { return this.showOkButton; }
            set { this.showOkButton = value; }
        }

        [Category("DialogControl")]
        public bool ShowAlphaBackground
        {
            get { return this.showAlphaBackground; }
            set { this.showAlphaBackground = value; }
        }

        [Category("DialogControl")]
        public Color AlphaBackgroundColor
        {
            get { return this.alphaBackgroundColor; }
            set { this.alphaBackgroundColor = value; }
        }

        public virtual bool OnOk()
        {
            return true;
        }

        public virtual bool OnCancel()
        {
            return true;
        }

        public virtual void SetFocusHandlers(IFocusHandler okButton, IFocusHandler cancelButton)
        {
        }

        [Category("DialogControl")]
        public string Title
        {
            get { return this.title; }
            set { this.title = value; }
        }

        #endregion
    }
}
